package com.xmg.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xmg.aop.AopTest;
import com.xmg.aop.PrintLog;
import com.xmg.day08.reflect.Autowired;
import com.xmg.mybatisplus.mapper.UserMapper;
import com.xmg.nio.netty.SimpleServerHandler;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import io.netty.util.CharsetUtil;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.net.InetSocketAddress;
import java.util.Iterator;
import java.util.List;

/**
 * @Author: mazhongqing
 * @Date: 2020/11/4 13:55
 */

@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    AopTest aopTest;
    @Resource
    UserMapper userMapper;

    @RequestMapping("/add")
    public User addUser(@RequestBody @Valid User user){

        return user;
    }


    @RequestMapping("/hello/{id}")
    @PrintLog
    public String hello(@PathVariable("id")Integer id){
//        aopTest.add();
//        List<com.xmg.mybatisplus.pojo.User> users = userMapper.selectList(new QueryWrapper<>());
//        System.out.println(users);
        System.out.println(id);
        int x = id/0;
        return "hello world";
    }
}